<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {
        function __construct()
        {
            parent::__construct();
            $this->load->model('modelo');
        }
	public function index()
        {            
            $this->load->view('header');
            $this->load->view('content');
            $this->load->view('footer');
        }        
        function Login()
        {
            $nickname = $this->input->post('nickname');
            $clave = $this->input->post('clave');
            
            $numero = $this->modelo->consulta($nickname,$clave)->num_rows();
            $msj="false";
            if($numero >0):
                $msj="true";
            endif;
            echo json_encode(array("msj"=>$msj));
        }
        function cargaRegistro()
        {
            $this->load->view('registro');
        }
        
        function cargaInicio()
        {               
            $dato = $this->modelo->cargaInicio()->result();
            $i=1;
            foreach ($dato as $row):
                $data['codigo'.$i] = $row->not_cod;
                $data['titulo'.$i] = $row->not_titulo;
                $data['foto'.$i] = $row->not_imagen;
                $data['descripcion'.$i] = $row->not_noticia;
                $i=$i+1;
            endforeach;
            $data['indice'] =$i;
            $this->load->view('noticias',$data);
        }
        function cargaNoticia($codigo)
        {               
            $dato = $this->modelo->cargaNoticia($codigo)->result();
            $i=0;
            foreach ($dato as $row):
                $data['codigo'.$i] = $row->not_cod;
                $data['titulo'.$i] = $row->not_titulo;
                $data['foto'.$i] = $row->not_imagen;
                $data['descripcion'.$i] = $row->not_noticia;
                $i=$i+1;
            endforeach;
            $data['indice'] =$i;
            $this->load->view('noticia',$data);
        }
        function cargaMision()
        {               
            $dato = $this->modelo->cargaMision()->result();
            $i=0;
            foreach ($dato as $row):
                $data['dato'.$i] = $row->mision;
                $data['foto'.$i] = $row->mision_img;
                $i=$i+1;
            endforeach;
            $data['indice'] =$i;
            $this->load->view('informe',$data);
        }
        function cargaVision()
        {               
            $dato = $this->modelo->cargaVision()->result();
            $i=0;
            
            foreach ($dato as $row):
                $data['dato'.$i] = $row->vision;
                $data['foto'.$i] = $row->vision_img;
                $i=$i+1;
            endforeach;
            $data['indice'] =$i;
            $this->load->view('vision',$data);
        }
        function cargaEquipo()
        {               
            $dato = $this->modelo->cargaEquipo()->result();
            $i=0;
            foreach ($dato as $row):
                $data['rut'.$i] = $row->pers_rut;
                $data['foto'.$i] = $row->pers_foto;
                $data['apellido'.$i] = $row->pers_apellido;
                $data['nombre'.$i] = $row->pers_nombre;
                $data['profesion'.$i] = $row->pers_profesion;
                $data['descripcion'.$i] = $row->pers_descripcion;
                $i=$i+1;
            endforeach;
            $data['indice'] =$i;
            $this->load->view('personal',$data);
        }
        function cargaInformativos()
        {               
            $dato = $this->modelo->cargaInformativos()->result();
            $i=0;
            foreach ($dato as $row):
                $data['nombre'.$i] = $row->inf_nombre;
                $data['foto'.$i] = $row->inf_imagen;
                $data['descripcion'.$i] = $row->inf_descripcion;
                $i=$i+1;
            endforeach;
            $data['indice'] =$i;
            $this->load->view('informativos',$data);
        }
        function cargaPersona($rut)
        {               
            $dato = $this->modelo->cargaPersona($rut)->result();
            $i=0;
            foreach ($dato as $row):
                $data['rut'.$i] = $row->pers_rut;
                $data['foto'.$i] = $row->pers_foto;
                $data['apellido'.$i] = $row->pers_apellido;
                $data['nombre'.$i] = $row->pers_nombre;
                $data['profesion'.$i] = $row->pers_profesion;
                $data['descripcion'.$i] = $row->pers_descripcion;
                $data['telefono'.$i] = $row->pers_telefono;
                $data['celular'.$i] = $row->pers_celular;
                $data['correo'.$i] = $row->pers_correo;
                $i=$i+1;
            endforeach;
            $data['indice'] =$i;
            $this->load->view('persona',$data);
        }
        function cargaGaleria()
        {               
            $dato = $this->modelo->cargaGaleria()->result();
            $i=0;
            foreach ($dato as $row):
                $data['foto'.$i] = $row->gal_img;
                $i=$i+1;
            endforeach;
            $data['indice'] =$i;
            $this->load->view('galeria',$data);
        }
        function cargaContacto()
        {               
            $dato = $this->modelo->cargaContacto()->result();
            $i=0;
            foreach ($dato as $row):
                $data['correo'.$i] = $row->correo;
                $data['direccion'.$i] = $row->direccion;
                $data['telefono'.$i] = $row->telefono;
                $i=$i+1;
            endforeach;
            $data['indice'] =$i;
            $this->load->view('contacto',$data);
        }
        function cargaEspecialidades()
        {             
            $codigo=$_GET['codigo'];
            $dato = $this->modelo->cargaEspecialidades($codigo)->result();
            $i=0;
            foreach ($dato as $row):
                $data['nombre'.$i] = $row->esp_nombre;
                $data['descripcion'.$i] = $row->esp_descripcion;
                $data['imagen'.$i] = $row->esp_img;
                $i=$i+1;
            endforeach;
            $data['indice'] =$i;
            $this->load->view('esp',$data);
        }
        function cargaTecnologia()
        {             
            $codigo=$_GET['codigo'];
            $dato = $this->modelo->cargaTecnologia($codigo)->result();
            $i=0;
            foreach ($dato as $row):
                $data['nombre'.$i] = $row->tec_nombre;
                $data['descripcion'.$i] = $row->tec_descripcion;
                $data['imagen'.$i] = $row->tec_img;
                $i=$i+1;
            endforeach;
            $data['indice'] =$i;
            $this->load->view('tec',$data);
        }
        
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */